Resource Tracer project
# Description
- A resource tracing, debugging and profiling tool
- [Restracer@gitverse](https://gitverse.ru/virtual.lark)

Crossplatform method to trace software errors in runtime during resource manipulation is shown. A scheme for describing abstract resources and their functions in XML is presented. Due to separation it's possible to describe vast classes of resources without changing the analyzer core. Detected errors often have an influence on security, safety, robustness and resource optimal usage.

## Supported programming languages

Language | Status
---------|-------------------
C        | :white_check_mark:
C++      | :construction:
others   | possible

## Supported multitasking
Method         | Status
---------------|-------------------
POSIX threads  | :white_check_mark:
fork()         | :construction:
Windows threads| possible

## Supported execution models

execution model | Status
----------------|-------------------
Userspace       | :white_check_mark:
Kernel          | possible
Embedded        | possible

## Supported traced application OS environment
OS            | Status
--------------|-------------------
`GNU/Linux`   | :white_check_mark:
`FreeBSD`     | :white_check_mark:
`Solaris`     | possible
`MacOS`       | possible
`Windows`     | possible

## Supported traced application hardware
Arch                 | Status
---------------------|-------------------
`IA32` (`x86`/`x64`) | :white_check_mark:
`IA64`               | possible
other 64bit          | possible
other 32bit          | possible
other 16bit          | possible
other 8bit           | possible

## Supported build tools
- `GNU Make`
- `BSD Make`

Environtment | BuildTool `GNU Make` | BuildTool `BSD Make` |
-------------|----------------------|----------------------|
`GNU/Linux`  | `make`               |                      |
`FreeBSD`    | `gmake`              | `make`               |


# Install
- You can install virtually on any current Linux distribution. Tested on Alt (tarball for p10, p9), Arch (tarball), Debian (package for stable, tarball for stable, oldstable, oldoldstable), Fedora (package for 39, 38), Gentoo, openSUSE (package/tarball for Tumbleweed, tarball for Leap 15.5), Ubuntu (package for 23.10, 22.04, 20.04)
- You can install on FreeBSD. Tested on version 13.X
## Fetch Deps
## Alt
- `sudo apt-get install -y wget gpg xz`
## Arch
- `sudo pacman -Sy --noconfirm wget`
## Debian
- `sudo apt-get install -y gpg wget`
## Fedora
- `sudo dnf install -y wget`
## openSUSE Tumbleweed (package)
- `zypper in -y wget dirmngr`
## openSUSE (Tumbleweed, Leap) tarball
- `zypper in -y wget dirmngr tar xz`
## Ubuntu
- `sudo apt-get install -y gpg wget`
## FreeBSD
- `sudo pkg install -y gnupg gmake`

## Fetch/Install phase
### Alt, Arch, Debian OldStable, OldOldStable, openSUSE Leap, Gentoo (tarballs)
- `sudo sh -c 'echo "92.63.64.5 skylark.tsu.ru" >> /etc/hosts'`
- `export GPG_KEY=B0414424`
- `export DISTRO_NAME=restracer-current-linux-amd64`
- `export DISTRO_TARBALL_NAME=$DISTRO_NAME.tar.xz`
- `export DISTRO_TARBALL_ASC_NAME=$DISTRO_TARBALL_NAME.asc`
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys $GPG_KEY || gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $GPG_KEY || gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys $GPG_KEY`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_TARBALL_ASC_NAME`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_TARBALL_NAME`
- `gpg --verify $DISTRO_TARBALL_ASC_NAME`
- `tar xf $DISTRO_TARBALL_NAME`
- `sudo ./install-run-deps.sh`
- `sudo cp -r bin lib /usr/local`
### Fedora (package)
- `sudo sh -c 'echo "92.63.64.5 skylark.tsu.ru" >> /etc/hosts'`
- `export GPG_KEY=B0414424`
- `export DISTRO_NAME=restracer-current-linux-amd64`
- `export DISTRO_PACKAGE_NAME=$DISTRO_NAME.rpm`
- `export DISTRO_PACKAGE_ASC_NAME=$DISTRO_PACKAGE_NAME.asc`
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys $GPG_KEY || gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $GPG_KEY || gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys $GPG_KEY`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_ASC_NAME`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_NAME`
- `gpg --verify $DISTRO_PACKAGE_ASC_NAME`
- `sudo dnf in -y $DISTRO_PACKAGE_NAME`
### openSUSE Tumbleweed (package)
- `sudo sh -c 'echo "92.63.64.5 skylark.tsu.ru" >> /etc/hosts'`
- `export GPG_KEY=B0414424`
- `export DISTRO_NAME=restracer-current-linux-suse-amd64`
- `export DISTRO_PACKAGE_NAME=$DISTRO_NAME.rpm`
- `export DISTRO_PACKAGE_ASC_NAME=$DISTRO_PACKAGE_NAME.asc`
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys $GPG_KEY || gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $GPG_KEY || gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys $GPG_KEY`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_ASC_NAME`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_NAME`
- `gpg --verify $DISTRO_PACKAGE_ASC_NAME`
- `sudo zypper in -y --allow-unsigned-rpm $DISTRO_PACKAGE_NAME`
### Debian Stable, Ubuntu (package)
- `sudo sh -c 'echo "92.63.64.5 skylark.tsu.ru" >> /etc/hosts'`
- `export GPG_KEY=B0414424`
- `export DISTRO_NAME=restracer-current-linux-amd64`
- `export DISTRO_PACKAGE_NAME=$DISTRO_NAME.deb`
- `export DISTRO_PACKAGE_ASC_NAME=$DISTRO_PACKAGE_NAME.asc`
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys $GPG_KEY || gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $GPG_KEY || gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys $GPG_KEY`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_ASC_NAME`
- `wget http://skylark.tsu.ru/art/master/linux/$DISTRO_PACKAGE_NAME`
- `gpg --verify $DISTRO_PACKAGE_ASC_NAME`
- `sudo dpkg -i $DISTRO_PACKAGE_NAME`
### FreeBSD
- `sudo sh -c 'echo "92.63.64.5 skylark.tsu.ru" >> /etc/hosts'`
- `export GPG_KEY=B0414424`
- `export DISTRO_NAME=restracer-current-freebsd-amd64`
- `export DISTRO_TARBALL_NAME=$DISTRO_NAME.tar.xz`
- `export DISTRO_TARBALL_ASC_NAME=$DISTRO_TARBALL_NAME.asc`
- `gpg --keyserver hkp://pgp.mit.edu --recv-keys $GPG_KEY || gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $GPG_KEY || gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys $GPG_KEY`
- `cd /tmp`
- `fetch http://skylark.tsu.ru/art/master/freebsd/restracer-current-freebsd-amd64.tar.xz.asc`
- `fetch http://skylark.tsu.ru/art/master/freebsd/restracer-current-freebsd-amd64.tar.xz`
- `gpg --verify $DISTRO_TARBALL_ASC_NAME`
- `tar xfm $DISTRO_TARBALL_NAME`
- `sudo ./install-run-deps.sh`
- `sudo cp -r local/bin local/lib /usr/local`

# Use
## Userspace
### Tracefile method (traced application writes to tracefile, then finishes noramally or not, then passing tracefile to analyzer)
- `cd src`
- `GNU Make@GNU/Linux:` `rt-make`
- `GNU Make@FreeBSD:` `rt-gmake`
- `BSD Make@FreeBSD:` `rt-make`
- `restracer ./myApp`
- `artrepgen --file tracefile.out`
### Pros
- More easy to debug restracer itself
- Less tricky to run Analyzer (`artrepgen`)
### Cons
- Can consume *lots* of diskspace

### Networked method (traced application writes to socket, analyzer runs in the same time)
- `cd src`
- `GNU Make@GNU/Linux:` `RT_TEMPLATE=posix-gcc-mt-netw-lint rt-make`
- `GNU Make@FreeBSD:` `RT_TEMPLATE=posix-gcc-mt-netw-lint rt-gmake`
- `BSD Make@FreeBSD:` `RT_TEMPLATE=posix-gcc-mt-netw-lint rt-make`
- `restracer ./myApp`
#### Pros
- Analyzer (`artrepgen`) can run on some remote location, outside of traced program / container
#### Cons
- Less easy to debug restracer itself
- Network throughput performance may be primary importance

# Uninstall
## Userspace
### Tarball
#### Linux (incomplete)
- `export GPG_KEY=B0414424; export DISTRO_TARBALL_NAME=restracer-current-linux-amd64.tar.xz; export DISTRO_TARBALL_ASC_NAME=$DISTRO_TARBALL_NAME.asc`
- `gpg --delete-keys --yes $GPG_KEY`
- `sudo rm -rf /usr/lib/restracer/`
- `rm -f $DISTRO_TARBALL_ASC_NAME        $DISTRO_TARBALL_NAME`
#### FreeBSD (incomplete)
- `export GPG_KEY=B0414424; export DISTRO_TARBALL_NAME=restracer-current-linux-amd64.tar.xz; export DISTRO_TARBALL_ASC_NAME=$DISTRO_TARBALL_NAME.asc`
- `gpg --delete-keys --yes $GPG_KEY`
- `sudo rm -rf /usr/local/lib/restracer/`
- `rm -f $DISTRO_TARBALL_ASC_NAME        $DISTRO_TARBALL_NAME`
### Package
#### Debian/Ubuntu
- `sudo apt-get remove restracer`
#### Fedora
- `sudo dnf remove restracer`
#### Alt
- `sudo apt-get remove restracer`
#### openSUSE
- `sudo zypper remove restracer`
